package com.jike.noobmoney.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import com.jike.noobmoney.entity.MyTaskChannelEntity;

import java.util.List;

/**
 * Created by xuke on 2016/9/24.
 * <p></p>
 */
public class ChannelsAdapter extends FragmentPagerAdapter {

    private List<MyTaskChannelEntity> titles;
    private List<Fragment> newsFragmentList;

    public ChannelsAdapter(FragmentManager fm, List<MyTaskChannelEntity> titles, List<Fragment> newsFragmentList) {
        super(fm);
        this.titles = titles;
        this.newsFragmentList = newsFragmentList;
    }

    public ChannelsAdapter(FragmentManager fm, List<MyTaskChannelEntity> titles, List<Fragment> newsFragmentList,List<Integer> counts) {
        super(fm);
        this.titles = titles;
        this.newsFragmentList = newsFragmentList;
    }
    @Override
    public Fragment getItem(int position) {
        return newsFragmentList.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position).getTitle();
    }

    @Override
    public int getCount() {
        return newsFragmentList.size();
    }

}
